package com.wsh.playeronline.ejb.bean;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;

import com.wsh.playeronline.ejb.service.GeneroRemote;
import com.wsh.playeronline.exception.ServiceException;
import com.wsh.playeronline.persistence.daoImpl.GeneroDAOImpl;
import com.wsh.playeronline.persistence.model.Genero;
import com.wsh.playeronline.util.JPAUtil;

@Stateless(mappedName="ejb/generoBean")
public class GeneroBean implements GeneroRemote {

	public void adicionar(Genero t) throws ServiceException {
		
		EntityManager em = new JPAUtil().getEntityManager();
		em.getTransaction().begin();
		
		GeneroDAOImpl dao = new GeneroDAOImpl(em);
		dao.adicionar(t);
		
		em.getTransaction().commit();
		em.close();
	}

}
